package com.wayhome.springframework.beans;

import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

public class PropertyValues {

    private List<PropertyValue> propertyValueList = new ArrayList<>();

    public void addPropertyValue(PropertyValue propertyValue){
       this.propertyValueList.add(propertyValue);
    }

    public PropertyValue[] getPropertyValues(){
        return propertyValueList.toArray(new PropertyValue[0]);
    }

    public PropertyValue getPropertyValue(String name){
        for (PropertyValue propertyValue : propertyValueList){
            if (name.equals(propertyValue.getName())){
                return propertyValue;
            }
        }
        return null;
    }
}
